package controllers

import (
	beego "github.com/beego/beego/v2/server/web"
)

// ResponseController operations for Response
type ResponseController struct {
	beego.Controller
}

type User1 struct {
	Id       int    `json:"-"`
	Username string `json:"name"`
	Phone    string
}
type User2 struct {
	Id       int    `xml:"-"`
	Username string `xml:"name"`
	Phone    string
}

type User3 struct {
	Id       int    `jsonp:"-"`
	Username string `jsonp:"name"`
	Phone    string
}

// URLMapping ...
func (c *ResponseController) URLMapping() {
	c.Mapping("Post", c.Post)
	c.Mapping("GetOne", c.GetOne)
	c.Mapping("GetAll", c.GetAll)
	c.Mapping("Put", c.Put)
	c.Mapping("Delete", c.Delete)
}

// Post ...
// @Title Create
// @Description create Response
// @Param	body		body 	models.Response	true		"body for Response content"
// @Success 201 {object} models.Response
// @Failure 403 body is empty
// @router / [post]
func (c *ResponseController) Post() {

}

// GetOne ...
// @Title GetOne
// @Description get Response by id
// @Param	id		path 	string	true		"The key for staticblock"
// @Success 200 {object} models.Response
// @Failure 403 :id is empty
// @router /:id [get]
func (c *ResponseController) GetOne() {
	//var u1 = User1{
	//	Id:       1,
	//	Username: "zhangsan",
	//	Phone:    "13800138000",
	//}
	//c.Data["json"] = u1
	//c.ServeJSON()

	/*var u2 = User2{
		Id:       1,
		Username: "zhangsan",
		Phone:    "13800138000",
	}
	c.Data["xml"] = u2
	c.ServeXML()*/

	user := User3{1, "tizi365", "13089818901"}
	c.Data["jsonp"] = &user
	c.ServeJSONP()
}

// GetAll ...
// @Title GetAll
// @Description get Response
// @Param	query	query	string	false	"Filter. e.g. col1:v1,col2:v2 ..."
// @Param	fields	query	string	false	"Fields returned. e.g. col1,col2 ..."
// @Param	sortby	query	string	false	"Sorted-by fields. e.g. col1,col2 ..."
// @Param	order	query	string	false	"Order corresponding to each sortby field, if single value, apply to all sortby fields. e.g. desc,asc ..."
// @Param	limit	query	string	false	"Limit the size of result set. Must be an integer"
// @Param	offset	query	string	false	"Start position of result set. Must be an integer"
// @Success 200 {object} models.Response
// @Failure 403
// @router / [get]
func (c *ResponseController) GetAll() {

}

// Put ...
// @Title Put
// @Description update the Response
// @Param	id		path 	string	true		"The id you want to update"
// @Param	body		body 	models.Response	true		"body for Response content"
// @Success 200 {object} models.Response
// @Failure 403 :id is not int
// @router /:id [put]
func (c *ResponseController) Put() {

}

// Delete ...
// @Title Delete
// @Description delete the Response
// @Param	id		path 	string	true		"The id you want to delete"
// @Success 200 {string} delete success!
// @Failure 403 id is empty
// @router /:id [delete]
func (c *ResponseController) Delete() {

}
